define(['app'], function (app) {
  app.registerProvider(
    'routeDefs',
    [
      '$stateProvider',
      '$urlRouterProvider',
      '$couchPotatoProvider',
      function ($stateProvider,
                $urlRouterProvider,
                $couchPotatoProvider) {

        this.$get = function () {
          // this is a config-time-only provider
          // in a future sample it will expose runtime information to the app
          return {};
        };
        var access = routingConfig.accessLevels;
        //
        //$urlRouterProvider
        //  .when('/u?id', '/users/:id')
        //  .when('', '/')
        //  .when('/contacts/:id', '/users/:id');

        $stateProvider
          .state('app', {
            //abstract: true,
            url: '/',
            templateUrl: 'views/main.html',
            controller: 'MainCtrl'
          })
        // Public routes
        $stateProvider
          .state('public', {
            abstract: true,
            template: "<ui-view/>",
            data: {
              access: access.public
            }
          })
          .state('public.404', {
            url: '/404/',
            templateUrl: '404.html'
          });

        // Anonymous routes
        $stateProvider
          .state('anon', {
            abstract: true,
            template: "<ui-view/>",
            data: {
              access: access.anon
            }
          })
          .state('anon.login', {
            url: '/login',
            template: '<login></login>'
            //controller: 'LoginCtrl'
          })
          .state('anon.register', {
            url: '/register/',
            templateUrl: 'register'
          });

        $stateProvider
          .state('about', {
            url: '/about',
            templateProvider: ['$timeout',
              function ($timeout) {
                return $timeout(function () {
                  return 'Hello world';
                }, 100);
              }]
          });
      }
    ]
  );
});
